home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1190 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. Path: atglab.bls.com!Alun.Champion
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Creating a pointer to a function "void (*ptrFunction)()"  inside a class
  5. Date: 09 Jan 1996 20:21:02 GMT
  6. Organization: Computer People Inc.
  7. Message-ID: <ALUN.CHAMPION.96Jan9152102@g7240065.bridge.bst.bls.com>
  8. References: <30ECA10F.3D99@ifu.net> <NITIN.96Jan5125830@more.eng.sun.com>
  9.     <4crquj$7t1@lib108.its.rpi.edu> <NITIN.96Jan9103242@more.eng.sun.com>
  10. NNTP-Posting-Host: bstfirewall.bst.bls.com
  11. In-reply-to: nitin@more.eng.sun.com's message of 09 Jan 1996 18:32:42 GMT
  12.  
  13. In article <NITIN.96Jan9103242@more.eng.sun.com> nitin@more.eng.sun.com (Nitin More [CONTRACTOR]) writes:
  14.  
  15. : In article <4crquj$7t1@lib108.its.rpi.edu> floydb1@lib108.its.rpi.edu (Barry B Floyd) writes:
  16.  
  17. : [original message deleted]
  18. : [text deleted]
  19.  
  20. : > note: "Function ( int, int )" remains virtual in DerivedClass,
  21. : > even though the keyword "virtual" is not included in the declaration.
  22. : > Thus, I believe "class DerivedDerivedClass : DerivedClass" must provide
  23. : > a "Function ( int, int )" as well.
  24.  
  25. : I believe the last paragraph is wrong.  Somebody please correct me if I am
  26. : wrong. 
  27.  
  28. : (1) The "Function ( int, int )" *does not* remain virtual in DerivedClass
  29. :     unless the keyword "virtual" is included in the declaration.
  30.  
  31. I am afraid it does remain virtual.
  32.  
  33. [excerpt from standard]
  34. 10.3 Virtual Functions
  35. ...
  36. 2   If a virtual member function vf is declared in a class Base and in a class
  37.     Derived, derived directly or indirectly from Base, a member function vf with
  38.     the same name and same parameter list as Base::vf is declared, then
  39.     Derived::vf is also virtual (whether or not it is so declared) and it
  40.     overrides Base::vf. ...
  41. ...
  42.  
  43. : (2) The "class DerivedDerivedClass : DerivedClass" *does not* have to provide
  44. :     a "Function ( int, int )" as well as long as one of its derived classes
  45. :     has provided definition for the pure virtual function.
  46.  
  47. Correct. It does remain virtual but it is no longer pure because of the
  48. implementation in DerivedClass.
  49.  
  50. Hope this helps
  51. Regards
  52.  
  53.     -A.
  54. -- 
  55. | A.Champion                |
  56.